package com.ruoyi.web.controller.system;

import com.ruoyi.system.domain.User;
import com.ruoyi.system.service.impl.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

@RestController
public class HelloController {
    @Autowired
    private UserService userService;

    @GetMapping("/get")
    public List<User> hello(){
        return userService.selectAllUser();
    }

    @PostMapping("/insert")
    public Integer save(@RequestBody User user){
        return userService.save(user);
    }

    @PutMapping("/update")
    public Integer update(@RequestBody User user){
        return userService.update(user);
    }

    @DeleteMapping("/delete/{id}")
    public Integer delete(@PathVariable Integer id){
        return userService.delete(id);
    }
}

